<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>fetch_synset_pointers (WordNet::Synset)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File lib/wordnet/synset.rb, line 876</span>
                                        <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fetch_synset_pointers</span>( <span class="ruby-identifier">type</span>, <span class="ruby-identifier">subtype</span>=<span class="ruby-keyword kw">nil</span> )
                                                <span class="ruby-identifier">synsets</span> = <span class="ruby-keyword kw">nil</span>

                                                <span class="ruby-comment cmt"># Iterate over this synset's pointers, looking for ones that match</span>
                                                <span class="ruby-comment cmt"># the type we're after. When we find one, we extract its offset and</span>
                                                <span class="ruby-comment cmt"># use that to look it up.</span>
                                                <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">synchronize</span>( <span class="ruby-constant">Sync</span><span class="ruby-operator">::</span><span class="ruby-constant">SH</span> ) <span class="ruby-keyword kw">do</span>
                                                        <span class="ruby-identifier">synsets</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pointers</span>.
                                                        <span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ptr</span><span class="ruby-operator">|</span>
                                                                <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">type</span> <span class="ruby-keyword kw">and</span>
                                                                <span class="ruby-identifier">subtype</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">subtype</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">subtype</span>
                                                                }.
                                                                <span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ptr</span><span class="ruby-operator">|</span> <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">synset</span> }.
                                                                <span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@lexicon</span>.<span class="ruby-identifier">lookup_synsets_by_key</span>( <span class="ruby-identifier">key</span> )}
                                                        <span class="ruby-keyword kw">end</span>

                                                        <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">synsets</span>.<span class="ruby-identifier">flatten</span>
                                                <span class="ruby-keyword kw">end</span></pre>
</body>
</html>